#[cfg(test)]
mod tests {
    use anyhow::{Ok, Result};

    use crate::{
        rest_api::{
            api_user::LoginParams,
            service::srv_user::{self},
        },
        test::test_common::tests::test_common_init,
    };

    #[tokio::test]
    async fn test_get_user_roles() -> Result<()> {
        test_common_init().await?;

        let login_result = srv_user::login(&LoginParams {
            login_name: "admin".into(),
            password: "admin".into(),
        })
        .await?;

        assert!(!login_result.user.id.is_empty());
        assert_eq!(login_result.user.login_name.unwrap(), "admin");
        assert_eq!(login_result.user.roles.clone().unwrap().len(), 1);
        assert_eq!(login_result.user.roles.clone().unwrap()[0], "admin");

        Ok(())
    }
}
